<template>
	<div>
		<el-breadcrumb separator-class="el-icon-arrow-right">
		  	<el-breadcrumb-item :to="{ path: '/admin' }">homepage</el-breadcrumb-item>
		  	<el-breadcrumb-item>Add Account</el-breadcrumb-item>
		</el-breadcrumb>
		<el-form ref="form" :model="formData" label-width="160px">
		  	<el-form-item label="username">
		    	<el-input v-model="formData.LoginEmail"></el-input>
		  	</el-form-item>

		  	<el-form-item label="password">
		    	<el-input v-model="formData.pass"></el-input>
		  	</el-form-item> 
		  	
		  	<el-form-item label="employeeName">
		    	<el-input v-model="formData.employeeName"></el-input>
		  	</el-form-item> 
		  	
  		  <el-form-item>
		    	<el-button type="primary" @click="addUser">Add Account</el-button>
		    	<el-button>cancel</el-button>
		  	</el-form-item>
		</el-form>
	</div>
</template>

<script type="text/javascript">
	export default{
		data(){
			return{
				formData:{
					username:"",
					password:"",
					platfrom:1,
										
				}
			}
		},
		created(){
			this.formData._token = window.axios.defaults.headers.common['X-CSRF-TOKEN'];
		},
		methods:{
			handleRemove(file, fileList) {
		        console.log(file, fileList);
		    },
		    handlePreview(file) {
		        console.log(file);
		   	},
		    handlePictureCardPreview(file) {
		        this.dialogImageUrl = file.url;
		        this.dialogVisible = true;
		    },
		    handleExceed(files, fileList) {
	        	this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
	      	},
		    beforeRemove(file, fileList) {
		        return this.$confirm(`确定移除 ${ file.name }？`);
		    },
		    addUser(){
		    	axios.post('/api/admin/add',this.formData)
		    		.then(result => {
		    			if(result.data.code == 200){
		    				this.$notify({
		    					type:"success",
		    					message:result.data.message
		    				})
		    			}else{
		    				this.$notify.error(result.data.message);
		    			}
		    		})
		    		.catch(error => {

		    		})
		    }
		}
	}
</script>

<style type="text/css">
	input[type=file] {
	    display: none;
	}
</style>